<?php

class Application_Form_assignerroleservice extends Zend_Form
{

    public function init()
    {
        /* Form Elements & Other Definitions Here ... */
    	
    	$this->setName("Formulaireassignerroleservice");
    	
    	$mapper= new Application_Model_Mapper_Role();
    	$select=$mapper->fetchAllToArray();
    	
    	
    	$tmp=array();
    	$tmp['role']="selectionner un role";
    	foreach ($select as $key => $value ){
    		$tmp[ $value['idrole'] ] = $value['idrole'];
    	}
    	$listrole = array("multiOptions" => $tmp);
    	
    	$listrole= new Zend_Form_Element_Select('role_idrole',  $listrole);
    	$listrole->setLabel('Role')	;
    	//$listrole->setAttrib('onChange', "loadCombo('diplomeselector','id='+this.value+'&typedip=Domaine','option4');");
    	
    	
    	
    	$mapperaxes = new Application_Model_Mapper_Services();
    	$axes=$mapperaxes->fetchAllToArray();
    	
    	$checkboxlist=array();
    	
    	foreach($axes as $key => $value){
    		$checkboxlist[$value['idservices']]=$value['monmenu'];
    	}
    	
    	$element = new Zend_Form_Element_MultiCheckbox('services_idservices', array(
    			'multiOptions' => $checkboxlist
    	));
    	$element->setLabel("Services");
    	
    	$submit = new Zend_Form_Element_Submit('submit');
    	$submit->setLabel("Assigner");
    	
    	$this->addElements(array($listrole,$element,$submit));
    	$this->setDecorators( array( array('ViewScript', array('viewScript' => 'protypeform.phtml'))));
    	
    }
}

